package com.sparrows.pirates.screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.Texture;
import com.sparrows.pirates.SparrowPiratesGame;

public class LoadingScreen implements Screen{
	
	SparrowPiratesGame game;
	float progress;
	Texture loadingTex;
	
	public LoadingScreen(SparrowPiratesGame gam){
		game = gam;
		game.manager.load("textures/environment/textureSheet1.png", Texture.class);
		game.manager.load("textures/textureSheetSmall.png", Texture.class);
		
		loadingTex = new Texture(Gdx.files.internal("textures/misc/loading.png"));
	}

	@Override
	public void render(float delta) {
		if (game.manager.update()){
			//game.setScreen(new MainMenuScreen(game));
			game.setScreen( new NavalBattleScreen(game, 1, 1, 0));
		}
		
		progress = game.manager.getProgress();
		game.spriteBatch.begin();
		game.spriteBatch.draw(loadingTex, game.screenSize.x/2 - loadingTex.getWidth()/2, game.screenSize.y/2 - loadingTex.getHeight()/2);
		game.spriteBatch.end();
		
	}

	@Override
	public void resize(int width, int height) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void show() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void hide() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void pause() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void resume() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub
		
	}

}
